package com.leonzhangxf.guice.bill.domain;

/**
 * The receipt of a order contains result.
 *
 * @author leonzhangxf
 */
public class Receipt {

    private Integer amount;

    private String declineMessage;

    public static Receipt forSuccessfulCharge(Integer amount) {
        return new Receipt(amount, null);
    }

    public static Receipt forDeclinedCharge(String declineMessage) {
        return new Receipt(null, declineMessage);
    }

    public static Receipt forSystemFailure(String message) {
        return new Receipt(null, message);
    }

    public Receipt(Integer amount, String message) {
        this.amount = amount;
        this.declineMessage = message;
    }

    public Integer getAmount() {
        return amount;
    }

    public String getDeclineMessage() {
        return declineMessage;
    }

    @Override
    public String toString() {
        return "Receipt{" +
            "amount=" + amount +
            ", declineMessage='" + declineMessage + '\'' +
            '}';
    }
}
